<template>
	<view class="container-head" @click.stop="">
		<view class="uamuhead">
			<text @tap="handleToBack" class="iconfont">&#xe837;</text>
			<text class="iconfont">&#xe680;</text>
			<text @tap="handleToHome" class="iconfont">&#xe626;</text>
		</view>
		<view class="title-container">
			<view class="title-text">{{ title }}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "uamhead",
		props: ['title'],
		methods: {
			handleToBack() {
				uni.navigateBack({
					// delta: 2
				});
			},
			handleToHome() {
				uni.navigateTo({
					url: '/pages/index/index'
				});
			}
		}
	}
</script>

<style scoped>
	.container-head {
		position: absolute;
		/* 设置为绝对定位 */
		top: 0;
		/* 从顶部开始 */
		left: 0;
		/* 从左侧开始 */
		width: 100%;
		/* 宽度占据整个页面 */
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-top: 20rpx;
		z-index: 999;
		/* 设置 z-index 为一个较高的值 */
	}

	.uamuhead {
		display: flex;
		align-items: center;
		/* 垂直居中对齐 */
		margin-left: 20rpx;
	}

	.title-container {
		flex: 1;
		/* 占据剩余空间 */
		display: flex;
		justify-content: center;
		/* 水平居中对齐 */
		align-items: center;
		/* 垂直居中对齐 */
	}

	.title-text {
		text-align: center;
		margin-left: -68px;
		/* 让文本水平居中对齐 */
	}
</style>